package com.example.design.openfeign;

import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map;

/**
 * Feign客户端
 * @author wangli
 * @version 1.0
 * @date 2023/9/19 12:29
 */
@Component
public class DynamicClient  {
    @Resource
    private DynamicFeignClientFactory<DynamicService> dynamicFeignClientFactory;

    public Object executePostApi(String feignName, String url, Object params, Map<String, String> headers, Map<String, String> requestPage) {
        DynamicService dynamicService = dynamicFeignClientFactory.getFeignClient(DynamicService.class, feignName);
        return dynamicService.executePostApi(url, params,headers,requestPage);
    }

    public Object executeGetApi(String feignName, String url, Object params, Map<String, String> headers) {
        DynamicService dynamicService = dynamicFeignClientFactory.getFeignClient(DynamicService.class, feignName);
        return dynamicService.executeGetApi(url, params,headers);
    }

}
